package com.atguigu.gmall.task.t0;

import com.atguigu.gmall.constant.MqConst;
import com.atguigu.gmall.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定时器
 */
@Component
@EnableScheduling
public class Task0 {


    @Autowired
    private RabbitService rabbitService;

    //半夜0点
    //@Scheduled(cron = "0 * * * * ?")
    @Scheduled(cron = "0/30 * * * * ?")
    public void task0(){
        //到点了
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,
                MqConst.ROUTING_TASK_1,"");
    }

}
